package com.erp.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

import com.erp.Interface.ScrollViewListener;

/**
 * Created by Administrator on 2016/11/3 0003.
 * 暴露scrollview滑动监听接口
 */
public class ObservableScrollView extends ScrollView {
    private ScrollViewListener scrollViewListener=null;
    public ObservableScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public ObservableScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ObservableScrollView(Context context) {
        super(context);
    }
    public void setScrollViewListener(ScrollViewListener scrollViewListener) {
        this.scrollViewListener = scrollViewListener;
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);
        if(scrollViewListener!=null){
            scrollViewListener.onScrollChanged(this,l,t,oldl,oldt);
        }
    }
}
